package com.lmt.controller;

import com.lmt.common.entity.Result;
import com.lmt.common.util.ResultUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/permission")
public class PermissionController {


    @RequestMapping("/userInfoSearch")
    @RequiresPermissions("userInfo:search")
    public Result userSearch() {
        return ResultUtil.success("userInfoSearch");
    }

    @RequestMapping("/shiroConfiguration")
    public Result shiroConfiguration() {
        return ResultUtil.success("/permission/shiroConfiguration ---> userInfo:search");
    }

    @RequestMapping("/userInfoAdd")
    @RequiresPermissions("userInfo:add")
    public Result userInfoAdd() {
        return ResultUtil.success("userInfoAdd");
    }

    @RequestMapping("/userInfoUpdate")
    @RequiresPermissions("userInfo:update")
    public Result userInfoUpdate() {
        return ResultUtil.success("userInfoUpdate");
    }

    @RequestMapping("/userInfoDelete")
    @RequiresPermissions("userInfo:delete")
    public Result userInfoDel() {
        return ResultUtil.success("userInfoDelete");
    }

    @RequestMapping("/anyPermission")
    public Result anyPermission() {
        return ResultUtil.success("anyPermission ---> userInfo:add Or userInfo:update");
    }

    @RequestMapping("/notNeedPermission")
    public Result notNeedPermission() {
        return ResultUtil.success("notNeedPermission");
    }
}
